﻿@model IEnumerable<CarparkIMS_CMS.Models.CameraParkingModel>

@{
    ViewData["Title"] = "Index";
}

<h1>
    泊車位狀態列表
</h1>

 
<div class="container-fluid">
    <table class="table table-responsive">
        <thead>
            <tr>
                <th>
                    Camera IP
                </th>
                <th style="min-width:180px;">
                    Parking Place Number#
                </th>
                <th style="min-width:180px;">
                    STATUS
                </th>
                <th style="min-width:180px;">
                    START
                </th>
                <th style="min-width:180px;">
                    END
                </th>
                <th>DELETED</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @item.CameraIP
                    </td>
                    <td>
                        <span class="rounded text-secondary p-2"> @item.ParkingPlaceId </span>
                        <label>/</label>
                        <span class="rounded text-dark p-2"> @item.ParkingPlaceSharpNumber </span>
                    </td>
                    <td>
                        @if (item.llqqNumberPlate == null)
                        {
                            <span class="rounded badge-warning p-2"> 車位空置中 </span>
                        }
                        else if (item.llqqNumberPlate.EndDatetime == null)
                        {
                            <span class="rounded badge-success p-2"> 車位使用中 </span>
                        }
                        else if (item.llqqNumberPlate.EndDatetime != null)
                        {
                            <span class="rounded badge-warning p-2"> 車位空置中 </span>
                        }
                    </td>
                    <td>
                        @if (item.llqqNumberPlate?.StartDatetime != null)
                        {
                            <span class="rounded">@Html.Raw(string.Format("{0:HH:mm:ss <br> yyyy-MM-dd}",item.llqqNumberPlate.StartDatetime)) </span>
                        }
                        else
                        {
                            <span class="rounded"><i class="fas fa-clock"></i> </span>
                        }
                    </td>
                    <td>
                        @if (item.llqqNumberPlate?.EndDatetime != null)
                        {
                            <span class="rounded">@Html.Raw(string.Format("{0:HH:mm:ss <br> yyyy-MM-dd}",item.llqqNumberPlate.EndDatetime)) </span>
                        }
                        else
                        {
                            <span class="rounded"><i class="fas fa-clock"></i> </span>
                        }
                    </td>
                    <td>
                        @if (item.Deleted == true)
                        {
                            <span class="rounded">當前車位處於刪除中 </span>
                        }
                        else
                        {
                            <span class="rounded">正常 </span>
                        }
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

